Skip to content

Dev/1.0.5#24

Merged
ez-plugins merged 17 commits intomainfrom
dev/1.0.5
Apr 18, 2026
Merged

Dev/1.0.5#24
ez-plugins merged 17 commits intomainfrom
dev/1.0.5

Conversation

@ez-plugins
Copy link
Copy Markdown
Contributor

@ez-plugins ez-plugins commented Apr 18, 2026

Pull request for 1.0.5

So far:

Github Pages Markdown Documentation

  • Added Markdown documentation in docs/ folder
    • Added Github workflow to publish documentation to Github Pages

Integrate QueryBuilderDefaults into all SELECT/DELETE builders

QueryBuilder, DeleteBuilder, and SelectBuilder each gain:

  • A queryBuilderDefaults field initialised from QueryBuilderDefaults.global()
    at construction time (snapshot semantics, not live).
  • A withDefaults(QueryBuilderDefaults) fluent method for per-instance
    override without touching the global.

Behavioural changes when a non-default QueryBuilderDefaults is active:

  • Dialect: buildSql() / build() null-fallback now routes to the
    configured dialect instead of hardcoded SqlDialect.STANDARD.
  • Default columns: rendered when no explicit select() columns are set.
  • Default limit / offset: applied when builder sentinel (-1) is present
    and the defaults carry a non-negative value (explicit wins).
  • LIKE wrapping: SelectBuilder.whereLike() now honours likePrefix /
    likeSuffix (previously had no wrapping at all, aligned with
    AbstractSqlDialect behaviour).

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@EzFramework EzFramework deleted a comment from github-actions bot Apr 18, 2026
Immutable config holder with JVM-wide global (volatile static) and
per-instance override support (builder.withDefaults(...)). Configures:
- SQL dialect (default: STANDARD)
- Default SELECT column expression (default: "*")
- Default LIMIT / OFFSET (default: -1, i.e. none)
- LIKE prefix / suffix (default: "%" / "%")

Global is captured at builder construction time so behaviour is
predictable across concurrent updates.
Three new fields propagated from QueryBuilderDefaults into the Query
data object at build() time so dialect-agnostic renderers can read them:
- defaultSelectColumns  (fallback when selectColumns is empty)
- likePrefix            (prepended to LIKE / NOT LIKE values)
- likeSuffix            (appended  to LIKE / NOT LIKE values)

All fields default to the existing hardcoded behaviour ("*", "%", "%")
so there is no change to query output without an explicit configuration.
AbstractSqlDialect now reads from the Query object instead of using
hardcoded literals:
- appendSelectColumns: uses query.getDefaultSelectColumns() instead of "*"
- LIKE / NOT LIKE params: uses query.getLikePrefix()/getLikeSuffix()
  instead of hardcoded "%" + val + "%"

appendConditionFragment gains a Query parameter to pass the hints
through to appendNonComparisonFragment.
QueryBuilder, DeleteBuilder, and SelectBuilder each gain:
- A queryBuilderDefaults field initialised from QueryBuilderDefaults.global()
  at construction time (snapshot semantics — not live).
- A withDefaults(QueryBuilderDefaults) fluent method for per-instance
  override without touching the global.

Behavioural changes when a non-default QueryBuilderDefaults is active:
- Dialect: buildSql() / build() null-fallback now routes to the
  configured dialect instead of hardcoded SqlDialect.STANDARD.
- Default columns: rendered when no explicit select() columns are set.
- Default limit / offset: applied when builder sentinel (-1) is present
  and the defaults carry a non-negative value (explicit wins).
- LIKE wrapping: SelectBuilder.whereLike() now honours likePrefix /
  likeSuffix (previously had no wrapping at all — aligned with
  AbstractSqlDialect behaviour).
…ping

QueryBuilderDefaultsTest (23 tests) covers:
- Canonical global defaults (STANDARD, "*", -1, -1, "%", "%")
- builder() and builder(source) factory methods
- setGlobal(null) NPE guard
- withDefaults(null) NPE guard on all three builders
- Global dialect applied to newly created QueryBuilder
- Per-instance withDefaults() overrides global for that instance only
- Explicit buildSql(table, dialect) parameter wins over configured default
- defaultColumns / explicit select() winner semantics
- defaultLimit / defaultOffset applied and overridden correctly
- Custom likePrefix / likeSuffix applied (QueryBuilder + SelectBuilder)
- DeleteBuilder dialect routing via withDefaults()
- SelectBuilder defaultColumns, defaultLimit, LIKE wrapping

SelectBuilderTest.testWhereLike: updated to pass the raw value ("bob")
instead of pre-wrapped "%bob%" now that SelectBuilder auto-wraps using
the configured likePrefix/likeSuffix (consistent with QueryBuilder).
Cover the five NullPointerException guards in QueryBuilderDefaults that
were previously unreachable in tests:
  - builder(null) on the static factory
  - Builder.dialect(null)
  - Builder.defaultColumns(null)
  - Builder.likePrefix(null)
  - Builder.likeSuffix(null)

Also add selectBuilderDefaultOffsetApplied to hit the true-branch of the
defaultOffset ternary in SelectBuilder.buildLimitOffsetClause().

QueryBuilderDefaults now reports 100% line coverage; SelectBuilder
reaches 97.7% (only the unreachable UnsupportedOperationException path
for unknown operators remains uncovered).
test: add null-guard and SelectBuilder offset tests for full coverage
@ez-plugins ez-plugins merged commit 028c847 into main Apr 18, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant